package com.devin.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtils {

    public static String toStr(Date date,String format){
        SimpleDateFormat dateFormat = new SimpleDateFormat(format);
        String format1 = dateFormat.format(date);
        return format1;

    }

    public static Date toDate(String date,String format) throws ParseException {
        SimpleDateFormat dateFormat = new SimpleDateFormat(format);
        Date parse = dateFormat.parse(format);
        System.out.println(parse);
        return parse;
    }
}
